package com.ruoyi.douyin.utils;

import cn.hutool.http.HttpUtil;

import java.util.HashMap;
import java.util.Random;

public class MessageUtils {
    public static String sendMessage(String mobile, String content) {
        String url = "http://v.juhe.cn/sms/send";
        HashMap<String, Object> paramMap = new HashMap<>();
        paramMap.put("key", "5829b6c962f915b1c637038e9eb971ad");
        paramMap.put("tpl_id", "224726");
        paramMap.put("tpl_value", "" + content);
        paramMap.put("mobile", mobile);
        return HttpUtil.get(url, paramMap);
    }


    public static String sendMessage(String mobile, String content, String model) {
        String url = "http://v.juhe.cn/sms/send";
        HashMap<String, Object> paramMap = new HashMap<>();
        paramMap.put("key", "5829b6c962f915b1c637038e9eb971ad");
        paramMap.put("tpl_id", model);
        paramMap.put("tpl_value", "" + content);
        paramMap.put("mobile", mobile);
        return HttpUtil.get(url, paramMap);
    }

    public static String randomNum() {
        Random random = new Random();
        StringBuilder stringBuilder = new StringBuilder();
        for (int i = 0; i < 6; i++) {
            stringBuilder.append(random.nextInt(9));
        }
        return stringBuilder.toString();
    }
}
